
const path = require('path');
module.exports = {
  publicPath: process.env.NODE_ENV === 'production' ? '/admin/' : '/',
  outputDir: 'dist/admin',
  lintOnSave: false,
  productionSourceMap: false,
  runtimeCompiler: true,
  // devServer: {
  //   port: '8081',
  //   proxy: {
  //     '/myzc': {
  //       target: 'http://45.207.50.132',
  //       changOrigin: true,
  //       pathRewrite: {
  //         '^/myzc': '/myzc'
  //       }
  //     }
  //   }
  // },
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  },
  pluginOptions: {
    // 支持全景less变量
    // 'style-resources-loader': {
    //   preProcessor: 'less',
    //   patterns: [path.resolve(__dirname, './src/assets/styles/base.less')]
    // }
  },
  configureWebpack: {
    devtool: process.env.NODE_ENV === 'production' ? 'false' : 'source-map',
    resolve: {
      modules: [path.resolve(__dirname, 'views'), 'node_modules'],
      alias: {
        // vue$: 'vue/dist/vue.esm.js',
        '@': path.join(__dirname, 'src'),
        '@common': path.join(__dirname, 'src/components'),
        '@store': path.join(__dirname, 'src/store')
      }
    }
  },
  chainWebpack: config => {
    // 生成 report.html 以帮助分析包内容
    if (process.env.npm_config_report) {
      config
        .plugin('webpack-bundle-analyzer')
        .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin);
    }
  }
};
